//
//  ViewController.swift
//  swiftStudy
//
//  Created by hamilyjing on 2020/6/25.
//  Copyright © 2020 JJ. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var label: UILabel!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }
    
    @IBAction func click(_ sender: Any) {
        let service = JJServiceFactory.shared.getService(serviceName: "JJWeatherService") as! JJWeatherService
        service.requestWeather(networkSuccessResponse: { (model, otherInfo) in
            self.label.text = (model as! JJResponseBaseModel).resultDictionary!["errMsg"] as? String
            print("success")
        }) { (error, otherInfo) in
            self.label.text = "网络异常，请您稍后重试！"
            print("fail")
        }
    }
}

